<?php
/**
 * User: b179a9
 * Date: 10/12/11
 * Time: 6:39 PM
 */

class App_Plugin_Timer extends Zend_Controller_Plugin_Abstract
{

    public function preDispatch()
    {
        $manager = new \Managers\Map();
        $map = $manager->getAvailable();

        $timer = 0;
        if ($map) {
            $now = new DateTime();
            $timer = $map['dateend']->getTimestamp() - $now->getTimestamp();
//           print_r($map); die;

        }

        $layout = Zend_Layout::getMvcInstance();
        $view = $layout->getView();

        $view->timer = $timer;
        $view->mapInfo=$map;

    }

}
